
<?php include_once 'common/header.php'; ?>
<!-- admin_main -->
<div class="admin_main">
    <!-- Admin_top end -->
    <?php include_once 'common/borrow_left.php'; ?>
    <!-- Admin_Left End -->
    <div class="admin_right">
        <div class="admin_right_title"><strong>贷款管理</strong> >> 担保机构</div>
        <div class="admin_right_con">
            <table border="0" cellspacing="1" cellpadding="0" bgcolor="#f0f0f0">
                <tr style="color:#636363;"> 
                    <td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>编号</strong></td>
                    <td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>机构类型</strong></td>
                    <td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>机构别名</strong></td>
                    <td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>机构名称</strong></td>
                    <td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>注册资金</strong></td>
                    <td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>所属省市</strong></td>
                    <td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>公司成立日期</strong></td>
                    <td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>开始合作时间</strong></td>
                    <td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>操作</strong></td>
                </tr>
                <?php foreach ($list as $key => $v) { ?>
                    <tr id="row_<?php echo $v['id']; ?>">
                        <td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $v['id']; ?></td>
                        <td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $borrow_guarantee[$v['type']]; ?></td>
                        <td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $v['alias']; ?></td>
                        <td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $v['name']; ?></td>
                        <td height="35" align="center" valign="middle" bgcolor="#FFFFFF">￥<?php echo number_format($v['account'], 2); ?></td>
                        <td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $v['province'] ? $area_list[$v['province']] : ''; ?> | <?php echo $v['city'] ? $area_list[$v['city']] : ''; ?></td>
                        <td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php if ($v['establishment_time'] == 0) {
                    echo "";
                } else {
                    echo date('Y-m-d H:i', $v['establishment_time']);
                } ?></td>
                        <td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php if ($v['collaboration_time'] == 0) {
                    echo "";
                } else {
                    echo date('Y-m-d H:i', $v['collaboration_time']);
                } ?></td>
                        <td height="35" align="center" valign="middle" bgcolor="#FFFFFF" id="chebiao_<?php echo $v['id']; ?>" >
                            <a href="/ychadmin/guarantee/edit_view/<?php echo $v['id']; ?>" >修改</a>
                            <a href="javascript:;" onclick="removeGuarantee(<?php echo $v['id']; ?>);">删除</a>
                        </td>
                    </tr>
<?php } ?>
                <tr>
                    <td colspan="8" align="right">
                        <form action="/ychadmin/guarantee/guaranteelist/" method="get">
                            机构名称：<input type="text" id="name" name="name" value="<?php echo $name; ?>" />

                            <input type="submit"/>
                        </form>
                    </td>
                </tr>
                <tr>
                    <td colspan="8"  height="35" align="center" valign="middle" bgcolor="#FFFFFF" class="page"><?php echo $this->pagination->create_links(); ?></td>
                </tr>
            </table>
        </div>
    </div>
    <!-- Admin_Right End -->
</div>
<!-- admin_main end -->


<div id="dialog" title="系统提示" style="display: none">
    <p id="msg" style="text-align: center"></p>
</div>
<script>
    function removeGuarantee(id) {
        $.ajax({
            type: "post",
            url: "/ychadmin/guarantee/remove/",
            data: "id=" + id,
            success: function (msg) {
                $("#dialog").dialog();
                if (msg > 0) {
                    $("#msg").html("删除成功！");
                    $("#row_" + id).hide();
                } else {
                    $("#msg").html("删除失败，请联系管理员！");
                }
                setTimeout(function () {
                    $("#dialog").dialog("close");
                }, 3000);
            },
            dataType: "text"
        });
    }
</script>

</body>
</html>
